import AppConfig from "../config/AppConfig";
import PathConfig from "../config/PathConfig";
import Singleton from "../context/Singleton";
import ObjectUtils from "../utils/ObjectUtils";
import Utils from "../utils/Utils";
import SoundManage from "./SoundManage";

export default class SoundHelp extends Singleton {

    static ButtonBase = ObjectUtils.formatString(PathConfig.SOUND_PATH, "button");

    /**背景音乐 */
    static SOUN_MUSIC = 0;

    /**按钮音效 */
    static SOUND_BUTTON = 1;


    playSound(url: string) {
        SoundManage.I.play(url, SoundHelp.SOUND_BUTTON)
    }

    playSoundDely(url: string, dely: number = 0) {
        if (dely === 0) {
            this.playSound(url);
        } else {
            Laya.timer.once(dely, this, this.playSound, [url])
        }


    }


    plyMusic(url: string) {
        SoundManage.I.play(url, SoundHelp.SOUN_MUSIC)
    }

}